Restore window scope for several workspace specific settings#4120
Restore window scope for several workspace specific settings#4120i10416 wants to merge 3 commits into
Conversation
Related to - Shopify#4119 - Shopify#4114
|
Just signed CLA |
|
BTW, this is never ruby-lsp/vscode/src/ruby/custom.ts Line 26 in 4c109e3 microsoft/vscode#123957 (comment) It must use inspect method to detect null value. |
| "description": "A shell command to activate the right Ruby version or add a custom Ruby bin folder to the PATH. Only used if rubyVersionManager is set to 'custom'", | ||
| "type": "string", | ||
| "scope": "machine" | ||
| "scope": "machine-overridable" |
There was a problem hiding this comment.
| }, | ||
| "rubyLsp.rubyVersionManager": { | ||
| "type": "object", | ||
| "scope": "window", |
There was a problem hiding this comment.
Ruby version manager could be different depending on workspaces.
| "description": "A shell command to activate the right Ruby version or add a custom Ruby bin folder to the PATH. Only used if rubyVersionManager is set to 'custom'", | ||
| "type": "string", | ||
| "scope": "machine" | ||
| "scope": "window" |
There was a problem hiding this comment.
It is safe to use window scope because untrusted workspace cannot execute command thanks to capabilities.untrustedWorkspaces options.
|
@vinistock Hello, Vinicius. Thank you for your effort to maintain and improve this project. Recently, I tried VS Code ruby-lsp, but I'm faced with the problem due to workspace specific setting scope. Could you take a look at this PR and review the changes? I already signed CLA. |
Motivation
With capabilities.untrustedWorkspaces.restrictedConfigurationsIt seems impossible to set customRubyCommand at workspace level because VS Code prevents the extension from reading the machine scope options in workspace's .vscode/settings.json.It fails with
Automatic Ruby environment activation with custom failed: Command failed: && ruby -EUTF-8:UTF-8 '/path/to/.vscode/extensions/shopify.ruby-lsp-0.10.4/activation.rb' zsh:1: parse error near &&'because the command here becomes&& ruby - ....ruby-lsp/vscode/src/ruby/custom.ts
Line 12 in 4c109e3
It is sometimes case with me to find two ruby projects use different tools to manage ruby.
It is also quite likely that different projects have bundleGemfile in different locations.
This change allows users to change some workspace specific settings for each workspace.
Related to
Implementation
Change option scope from "machine" to "machine-configurable"
Automated Tests
Manual Tests
Add the following .vscode/settings.json to your workspace and enable the extension.
{ "rubyLsp.rubyVersionManager": { "identifier": "custom" }, "rubyLsp.customRubyCommand": "{any command of your choice}" }